<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>优雅的毛玻璃登录页面</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/gsap.min.js"></script>
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3a0ca3;
            --text-color: #2b2d42;
            --bg-color: #f8f9fa;
            --card-bg: rgba(255, 255, 255, 0.2);
            --input-bg: rgba(255, 255, 255, 0.8);
            --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s ease;
        }

        .dark-mode {
            --primary-color: #4cc9f0;
            --secondary-color: #4895ef;
            --text-color: #f8f9fa;
            --bg-color: #121212;
            --card-bg: rgba(30, 30, 30, 0.3);
            --input-bg: rgba(50, 50, 50, 0.8);
            --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            min-height: 100vh;
            background: var(--bg-color);
            color: var(--text-color);
            transition: var(--transition);
            display: flex;
            justify-content: center;
            align-items: center;
            background-image: url('https://source.unsplash.com/random/1920x1080/?nature,water');
            background-size: cover;
            background-position: center;
            position: relative;
            overflow: hidden;
        }

        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: inherit;
            filter: blur(10px);
            z-index: -1;
            transform: scale(1.1);
        }

        .container {
            width: 100%;
            max-width: 1200px;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .auth-card {
            width: 100%;
            max-width: 400px;
            background: var(--card-bg);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 40px;
            box-shadow: var(--shadow);
            border: 1px solid rgba(255, 255, 255, 0.1);
            overflow: hidden;
            position: relative;
            transition: var(--transition);
        }

        .auth-card::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(
                    to bottom right,
                    rgba(255, 255, 255, 0.1),
                    rgba(255, 255, 255, 0)
            );
            transform: rotate(30deg);
            z-index: -1;
        }

        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo h1 {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 10px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .logo p {
            font-size: 14px;
            opacity: 0.8;
        }

        .form-group {
            margin-bottom: 20px;
            position: relative;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 500;
        }

        .form-control {
            width: 100%;
            padding: 12px 15px;
            border-radius: 10px;
            border: none;
            background: var(--input-bg);
            color: var(--text-color);
            font-size: 14px;
            transition: var(--transition);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .form-control:focus {
            outline: none;
            box-shadow: 0 0 0 2px var(--primary-color);
        }

        .options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            font-size: 13px;
        }

        .checkbox {
            display: flex;
            align-items: center;
        }

        .checkbox input {
            margin-right: 8px;
        }

        .forgot-password {
            color: var(--primary-color);
            text-decoration: none;
            transition: var(--transition);
        }

        .forgot-password:hover {
            text-decoration: underline;
        }

        .btn {
            width: 100%;
            padding: 12px;
            border-radius: 10px;
            border: none;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            margin-bottom: 20px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .divider {
            display: flex;
            align-items: center;
            margin: 20px 0;
        }

        .divider::before, .divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: rgba(255, 255, 255, 0.2);
        }

        .divider span {
            padding: 0 10px;
            font-size: 12px;
            opacity: 0.7;
        }

        .social-login {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-bottom: 20px;
        }

        .social-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            background: var(--input-bg);
            color: var(--text-color);
            border: none;
            cursor: pointer;
            transition: var(--transition);
        }

        .social-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .social-btn i {
            font-size: 18px;
        }

        .toggle-form {
            text-align: center;
            font-size: 14px;
        }

        .toggle-form a {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 600;
            transition: var(--transition);
        }

        .toggle-form a:hover {
            text-decoration: underline;
        }

        .theme-toggle {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--input-bg);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            transition: var(--transition);
            border: none;
            color: var(--text-color);
        }

        .theme-toggle:hover {
            transform: rotate(30deg);
        }

        /* 隐藏注册表单 */
        .register-form {
            display: none;
        }

        /* 动画类 */
        .fade-in {
            animation: fadeIn 0.5s ease-in-out;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .shake {
            animation: shake 0.5s ease-in-out;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-5px); }
            40%, 80% { transform: translateX(5px); }
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<div class="background-overlay"></div>
<div class="glass-glow"></div>

<div class="container">
    <div class="auth-card">
        <button class="theme-toggle" id="themeToggle">
            <i class="fas fa-moon"></i>
        </button>

        <div class="logo">
            <h1>欢迎回来</h1>
            <p>登录您的账户</p>
        </div>

        <!-- 登录表单 -->
        <form class="login-form" id="loginForm">
            <div class="form-group">
                <label for="loginEmail">电子邮箱</label>
                <input type="email" id="loginEmail" class="form-control" placeholder="请输入您的邮箱" required>
            </div>

            <div class="form-group">
                <label for="loginPassword">密码</label>
                <input type="password" id="loginPassword" class="form-control" placeholder="请输入您的密码" required>
            </div>

            <div class="options">
                <div class="checkbox">
                    <input type="checkbox" id="rememberMe">
                    <label for="rememberMe">记住我</label>
                </div>
                <a href="#" class="forgot-password" id="forgotPassword">忘记密码?</a>
            </div>

            <button type="submit" class="btn">登 录</button>

            <div class="divider">
                <span>或使用以下方式登录</span>
            </div>

            <div class="social-login">
                <button type="button" class="social-btn" title="使用微信登录">
                    <i class="fab fa-weixin"></i>
                </button>
                <button type="button" class="social-btn" title="使用QQ登录">
                    <i class="fab fa-qq"></i>
                </button>
                <button type="button" class="social-btn" title="使用微博登录">
                    <i class="fab fa-weibo"></i>
                </button>
                <button type="button" class="social-btn" title="使用支付宝登录">
                    <i class="fab fa-alipay"></i>
                </button>
            </div>

            <div class="toggle-form">
                还没有账号? <a href="#" id="showRegister">立即注册</a>
            </div>
        </form>

        <!-- 注册表单 -->
        <form class="register-form" id="registerForm">
            <div class="form-group">
                <label for="registerName">姓名</label>
                <input type="text" id="registerName" class="form-control" placeholder="请输入您的姓名" required>
            </div>

            <div class="form-group">
                <label for="registerEmail">电子邮箱</label>
                <input type="email" id="registerEmail" class="form-control" placeholder="请输入您的邮箱" required>
            </div>

            <div class="form-group">
                <label for="registerPassword">密码</label>
                <input type="password" id="registerPassword" class="form-control" placeholder="请设置密码" required>
            </div>

            <div class="form-group">
                <label for="registerConfirmPassword">确认密码</label>
                <input type="password" id="registerConfirmPassword" class="form-control" placeholder="请再次输入密码" required>
            </div>

            <button type="submit" class="btn">注 册</button>

            <div class="divider">
                <span>或使用以下方式登录</span>
            </div>

            <div class="social-login">
                <button type="button" class="social-btn" title="使用微信注册">
                    <i class="fab fa-weixin"></i>
                </button>
                <button type="button" class="social-btn" title="使用QQ注册">
                    <i class="fab fa-qq"></i>
                </button>
                <button type="button" class="social-btn" title="使用微博注册">
                    <i class="fab fa-weibo"></i>
                </button>
                <button type="button" class="social-btn" title="使用支付宝注册">
                    <i class="fab fa-alipay"></i>
                </button>
            </div>

            <div class="toggle-form">
                已有账号? <a href="#" id="showLogin">立即登录</a>
            </div>
        </form>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 元素引用
        const themeToggle = document.getElementById('themeToggle');
        const loginForm = document.getElementById('loginForm');
        const registerForm = document.getElementById('registerForm');
        const showRegister = document.getElementById('showRegister');
        const showLogin = document.getElementById('showLogin');
        const forgotPassword = document.getElementById('forgotPassword');
        const body = document.body;

        // 暗黑模式切换
        themeToggle.addEventListener('click', function() {
            body.classList.toggle('dark-mode');

            // 切换图标
            const icon = this.querySelector('i');
            if (body.classList.contains('dark-mode')) {
                icon.classList.remove('fa-moon');
                icon.classList.add('fa-sun');
                // 添加动画
                gsap.to(icon, { rotation: 360, duration: 0.5 });
            } else {
                icon.classList.remove('fa-sun');
                icon.classList.add('fa-moon');
                // 添加动画
                gsap.to(icon, { rotation: -360, duration: 0.5 });
            }
        });

        // 显示注册表单
        showRegister.addEventListener('click', function(e) {
            e.preventDefault();
            switchForms(loginForm, registerForm, '注册');
        });

        // 显示登录表单
        showLogin.addEventListener('click', function(e) {
            e.preventDefault();
            switchForms(registerForm, loginForm, '登录');
        });

        // 忘记密码
        forgotPassword.addEventListener('click', function(e) {
            e.preventDefault();
            alert('密码重置链接将发送到您的邮箱！');
        });

        // 表单切换函数
        function switchForms(hideForm, showForm, title) {
            // 更新标题
            document.querySelector('.logo h1').textContent = title === '登录' ? '欢迎回来' : '创建账户';
            document.querySelector('.logo p').textContent = title === '登录' ? '登录您的账户' : '加入我们的社区';

            // GSAP动画
            gsap.to(hideForm, {
                opacity: 0,
                y: -20,
                duration: 0.3,
                ease: 'power2.in',
                onComplete: function() {
                    hideForm.style.display = 'none';
                    showForm.style.display = 'block';
                    showForm.classList.add('fade-in');

                    gsap.fromTo(showForm,
                        { opacity: 0, y: 20 },
                        { opacity: 1, y: 0, duration: 0.5, ease: 'power2.out' }
                    );

                    setTimeout(() => {
                        showForm.classList.remove('fade-in');
                    }, 500);
                }
            });
        }

        // 登录表单提交
        loginForm.addEventListener('submit', function(e) {
            e.preventDefault();
            const email = document.getElementById('loginEmail').value;
            const password = document.getElementById('loginPassword').value;

            // 简单验证
            if (!email || !password) {
                shakeForm(loginForm);
                return;
            }

            // 模拟登录
            console.log('登录信息:', email, password);
            alert('登录成功！');
        });

        // 注册表单提交
        registerForm.addEventListener('submit', function(e) {
            e.preventDefault();
            const name = document.getElementById('registerName').value;
            const email = document.getElementById('registerEmail').value;
            const password = document.getElementById('registerPassword').value;
            const confirmPassword = document.getElementById('registerConfirmPassword').value;

            // 简单验证
            if (!name || !email || !password || !confirmPassword) {
                shakeForm(registerForm);
                return;
            }

            if (password !== confirmPassword) {
                alert('两次输入的密码不一致！');
                shakeForm(registerForm);
                return;
            }

            if (password.length < 6) {
                alert('密码长度不能少于6位！');
                shakeForm(registerForm);
                return;
            }

            // 模拟注册
            console.log('注册信息:', name, email, password);
            alert('注册成功！请登录。');
            switchForms(registerForm, loginForm, '登录');
        });

        // 表单抖动效果
        function shakeForm(form) {
            form.classList.add('shake');
            setTimeout(() => {
                form.classList.remove('shake');
            }, 500);
        }

        // 社交按钮点击事件
        document.querySelectorAll('.social-btn').forEach(btn => {
            btn.addEventListener('click', function() {
                const platform = this.querySelector('i').classList[1];
                let platformName = '';

                switch(platform) {
                    case 'fa-weixin': platformName = '微信'; break;
                    case 'fa-qq': platformName = 'QQ'; break;
                    case 'fa-weibo': platformName = '微博'; break;
                    case 'fa-alipay': platformName = '支付宝'; break;
                }

                alert(`即将跳转到${platformName}登录...`);
            });
        });

        // 初始动画
        gsap.from('.auth-card', {
            opacity: 0,
            y: 50,
            duration: 1,
            ease: 'elastic.out(1, 0.5)'
        });

    });
</script>
</body>
</html>